<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 获取当前时间，获取当前计算机的时间
        var nowTime=new Date();
        console.log(nowTime);
        // 1、获取年
        console.log(nowTime.getFullYear());
        // 2、获取月
        console.log(nowTime.getMonth());
        // 3、获取日
        console.log(nowTime.getDate());
        // 4、获取星期
        console.log(nowTime.getDay());
        // 5、获取小时
        console.log(nowTime.getHours());
        // 6、获取分
        console.log(nowTime.getMinutes());
        // 7、获取秒
        console.log(nowTime.getSeconds());
        // 8、获取毫秒
        console.log(nowTime.getMilliseconds())
        // 9、时间戳  当期时间距离 1970 1 1 0 0 0 秒的 毫秒数
        var time = new Date();
        console.log(time.getTime());
    </script>
</body>
</html>